home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "UCALC Fast Math Parser 1.0"
- ClientHeight = 5430
- ClientLeft = 1455
- ClientTop = 1200
- ClientWidth = 7785
- Height = 5835
- Left = 1395
- LinkTopic = "Form1"
- ScaleHeight = 5430
- ScaleWidth = 7785
- Top = 855
- Width = 7905
- Begin VB.CommandButton Command1
- Caption = "Start"
- Height = 375
- Left = 3600
- TabIndex = 35
- Top = 4560
- Width = 615
- End
- Begin VB.TextBox Text10
- Height = 285
- Left = 5640
- TabIndex = 31
- Top = 5040
- Width = 2055
- End
- Begin VB.TextBox Text9
- Height = 285
- Left = 2640
- TabIndex = 30
- Text = "1000"
- Top = 5040
- Width = 855
- End
- Begin VB.TextBox Text8
- Height = 285
- Left = 5640
- TabIndex = 29
- Text = "x^2+5x-10"
- Top = 4680
- Width = 2055
- End
- Begin VB.CommandButton btnPlot
- Caption = "Plot"
- Height = 375
- Left = 6960
- TabIndex = 21
- Top = 480
- Width = 615
- End
- Begin VB.CommandButton btnCalc
- Caption = "Calculate"
- Height = 375
- Left = 3480
- TabIndex = 20
- Top = 3840
- Width = 1335
- End
- Begin VB.CommandButton btnFunction
- Caption = "Define Function"
- Height = 375
- Left = 3480
- TabIndex = 19
- Top = 3360
- Width = 1335
- End
- Begin VB.CommandButton btnVariable
- Caption = "Define Variable"
- Height = 375
- Left = 3480
- TabIndex = 18
- Top = 2880
- Width = 1335
- End
- Begin VB.CommandButton btnEval
- Caption = "Calculate"
- Height = 375
- Left = 120
- TabIndex = 17
- Top = 1320
- Width = 1095
- End
- Begin VB.PictureBox Picture1
- Height = 1215
- Left = 3840
- ScaleHeight = 1155
- ScaleWidth = 2955
- TabIndex = 16
- Top = 840
- Width = 3015
- End
- Begin VB.TextBox Text7
- Height = 285
- Left = 3840
- TabIndex = 7
- Text = "-sin(x)/2"
- Top = 480
- Width = 3015
- End
- Begin VB.TextBox Text6
- Height = 285
- Left = 720
- TabIndex = 6
- Text = "(result)"
- Top = 4320
- Width = 2655
- End
- Begin VB.TextBox Text5
- Height = 285
- Left = 720
- TabIndex = 5
- Text = "test*area(3.5,10)+1234"
- Top = 3840
- Width = 2655
- End
- Begin VB.TextBox Text4
- Height = 285
- Left = 720
- TabIndex = 4
- Text = "area(length,width)=length*width"
- Top = 3360
- Width = 2655
- End
- Begin VB.TextBox Text3
- Height = 285
- Left = 720
- TabIndex = 3
- Text = "test=100"
- Top = 2880
- Width = 2655
- End
- Begin VB.TextBox Text2
- Height = 285
- Left = 720
- TabIndex = 2
- Text = "(result)"
- Top = 840
- Width = 2655
- End
- Begin VB.TextBox Text1
- Height = 285
- Left = 720
- TabIndex = 1
- Text = "3+4/5-8"
- Top = 480
- Width = 2655
- End
- Begin VB.Label Label19
- Caption = "Elapsed (sec) / Answer:"
- Height = 255
- Left = 3840
- TabIndex = 34
- Top = 5040
- Width = 1815
- End
- Begin VB.Label Label18
- Caption = "User Expression:"
- Height = 255
- Left = 4320
- TabIndex = 33
- Top = 4680
- Width = 1215
- End
- Begin VB.Label Label17
- Caption = "Summation from 1 to:"
- Height = 375
- Left = 1800
- TabIndex = 32
- Top = 4920
- Width = 855
- End
- Begin VB.Label Label16
- Alignment = 2 'Center
- BackColor = &H00FFFFC0&
- BorderStyle = 1 'Fixed Single
- Caption = "Speed Test"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 120
- TabIndex = 28
- Top = 4920
- Width = 1575
- End
- Begin VB.Line Line17
- BorderWidth = 2
- X1 = 120
- X2 = 3480
- Y1 = 4800
- Y2 = 4800
- End
- Begin VB.Line Line16
- BorderWidth = 2
- X1 = 3480
- X2 = 3480
- Y1 = 4800
- Y2 = 4440
- End
- Begin VB.Line Line15
- BorderWidth = 2
- X1 = 3480
- X2 = 7680
- Y1 = 4440
- Y2 = 4440
- End
- Begin VB.Label Label15
- Caption = "Text2 = ucEval(Text1)"
- Height = 255
- Left = 1800
- TabIndex = 27
- Top = 1560
- Width = 1695
- End
- Begin VB.Label Label14
- Caption = "Source Code:"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1800
- TabIndex = 26
- Top = 1320
- Width = 1095
- End
- Begin VB.Line Line14
- X1 = 1560
- X2 = 1680
- Y1 = 1680
- Y2 = 1560
- End
- Begin VB.Line Line13
- X1 = 1680
- X2 = 1560
- Y1 = 1560
- Y2 = 1440
- End
- Begin VB.Line Line12
- X1 = 1320
- X2 = 1680
- Y1 = 1560
- Y2 = 1560
- End
- Begin VB.Label Label13
- Caption = "Text6 = ucEval(Text5)"
- Height = 255
- Left = 5760
- TabIndex = 25
- Top = 3960
- Width = 1935
- End
- Begin VB.Label Label12
- Caption = "ucDefineFunction Text4"
- Height = 255
- Left = 5760
- TabIndex = 24
- Top = 3480
- Width = 1935
- End
- Begin VB.Label Label11
- Caption = "ucDefineVariable Text3"
- Height = 255
- Left = 5760
- TabIndex = 23
- Top = 3000
- Width = 1935
- End
- Begin VB.Label Label10
- Caption = "Source Code:"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 5760
- TabIndex = 22
- Top = 2520
- Width = 1095
- End
- Begin VB.Line Line11
- X1 = 5280
- X2 = 5400
- Y1 = 4200
- Y2 = 4080
- End
- Begin VB.Line Line10
- X1 = 5400
- X2 = 5280
- Y1 = 4080
- Y2 = 3960
- End
- Begin VB.Line Line9
- X1 = 5040
- X2 = 5400
- Y1 = 4080
- Y2 = 4080
- End
- Begin VB.Line Line8
- X1 = 5280
- X2 = 5400
- Y1 = 3720
- Y2 = 3600
- End
- Begin VB.Line Line7
- X1 = 5400
- X2 = 5280
- Y1 = 3600
- Y2 = 3480
- End
- Begin VB.Line Line6
- X1 = 5040
- X2 = 5400
- Y1 = 3600
- Y2 = 3600
- End
- Begin VB.Line Line5
- X1 = 5280
- X2 = 5400
- Y1 = 3240
- Y2 = 3120
- End
- Begin VB.Line Line4
- X1 = 5400
- X2 = 5280
- Y1 = 3120
- Y2 = 3000
- End
- Begin VB.Line Line3
- X1 = 5040
- X2 = 5400
- Y1 = 3120
- Y2 = 3120
- End
- Begin VB.Label Label9
- Caption = "Example usng ucEvaluate() in a time-critical loop"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 3840
- TabIndex = 15
- Top = 120
- Width = 3735
- End
- Begin VB.Line Line2
- BorderWidth = 2
- X1 = 3600
- X2 = 3600
- Y1 = 120
- Y2 = 2280
- End
- Begin VB.Line Line1
- BorderWidth = 2
- X1 = 7680
- X2 = 120
- Y1 = 2280
- Y2 = 2280
- End
- Begin VB.Label Label8
- Caption = "Example with a user-defined variable and function"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 720
- TabIndex = 14
- Top = 2520
- Width = 3615
- End
- Begin VB.Label Label7
- Caption = "Text4:"
- Height = 255
- Left = 120
- TabIndex = 13
- Top = 3360
- Width = 615
- End
- Begin VB.Label Label6
- Caption = "Text5:"
- Height = 255
- Left = 120
- TabIndex = 12
- Top = 3840
- Width = 615
- End
- Begin VB.Label Label5
- Caption = "Text6:"
- Height = 255
- Left = 120
- TabIndex = 11
- Top = 4320
- Width = 615
- End
- Begin VB.Label Label4
- Caption = "Text3:"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 2880
- Width = 615
- End
- Begin VB.Label Label3
- Caption = "Text2:"
- Height = 255
- Left = 120
- TabIndex = 9
- Top = 840
- Width = 615
- End
- Begin VB.Label Label2
- Caption = "Text1:"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 480
- Width = 615
- End
- Begin VB.Label Label1
- Caption = "Example using ucEval() for simplicity"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = -1 'True
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 720
- TabIndex = 0
- Top = 120
- Width = 2655
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- Dim x As Double, UserEq As Long, VarX As Integer
- Dim Sum As Double, TimerStart As Single, Elapsed As Single
- Text10 = ""
- Text10.Refresh
- TimerStart = Timer
- VarX = ucDefineVariable("x")
- UserEq = ucParse(Text8)
- For x = 1 To Text9
- ucVariableValue(VarX) = x
- Sum = Sum + ucEvaluate(UserEq)
- Next
- Elapsed = Timer - TimerStart
- Text10 = Int(Elapsed * 100) / 100 & " / " & Sum
- ucReleaseExpr 1
- End Sub
- Private Sub Form_Load()
- ucalcNull = ucEval("Display opening messages")
- End Sub
- ' Demonstrates the use of ucEval()
- ' Your program should include an error handler
- Private Sub btnEval_Click()
- On Error GoTo ErrorHandler
- Text2 = ucEval(Text1)
- If ucError = 0 Then Exit Sub
- ErrorHandler:
- If Err Then MsgBox Error$, vbExclamation
- If ucError Then MsgBox ucErrorMessage(-1), vbExclamation
- End Sub
- ' Demonstrates the fast ucEvaluate() function
- Private Sub btnPlot_Click()
- Dim x As Double, UserEq As Long, VariableX As Long
- On Error Resume Next
- Picture1.Cls
- Picture1.Scale (-10, 2)-(10, -2)
- Picture1.PSet (-10, 0)
- VariableX = ucDefineVariable("x")
- UserEq = ucParse(Text7)
- For x = -10 To 10 Step 0.5
- ucVariableValue(VariableX) = x
- Picture1.Line -(x, ucEvaluate(UserEq))
- Next
- ucReleaseExpr 1
- End Sub
- ' Defines a function at runtime
- Private Sub btnFunction_Click()
- ' On Error Goto ...
- ucDefineFunction Text4
- End Sub
- ' Defines a variable at runtime
- Private Sub btnVariable_Click()
- ' On Error GoTo ...
- ucDefineVariable Text3
- End Sub
- ' Example using the one-step ucEval() function
- ' Your program should include an error handler
- Private Sub btnCalc_Click()
- On Error GoTo ErrorHandler
- Text6 = ucEval(Text5)
- If ucError = 0 Then Exit Sub
- ErrorHandler:
- If Err Then MsgBox Error$, vbExclamation
- If ucError Then MsgBox ucErrorMessage(-1), vbExclamation
- End Sub
-